package com.prtek.reminder.bean;

import java.util.Date;
import java.util.List;
import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Id;
import org.greenrobot.greendao.annotation.JoinEntity;
import org.greenrobot.greendao.annotation.ToMany;
import org.greenrobot.greendao.annotation.Generated;
import org.greenrobot.greendao.DaoException;

/**
 * Created by jarly on 2018/9/7.
 */
@Entity public class Notes {

  @Id(autoincrement = true) private Long id;
  @ToMany
  @JoinEntity(entity = NotesJoinUser.class, sourceProperty = "notesId", targetProperty = "remindUserId")

  List<RemindUser> userList;
  /**
   * 提醒内容
   */
  private String desc;
  /**
   * 到期时间,格式:xxxx年xx月xx日
   */
  private String expireDate;
  /**
   * 创建时间,毫秒值
   */
  private Date startTimes;
  /**
   * 结束时间,毫秒值
   */
  private Date endTimes;
  /**
   * 用户名
   */
  private String userNames;
  /**
   * 内容类型
   */
  private int descType;
  /**
   * 文件路径
   */
  private String filePath;
  /** Used to resolve relations */
  @Generated(hash = 2040040024) private transient DaoSession daoSession;
  /** Used for active entity operations. */
  @Generated(hash = 295491671) private transient NotesDao myDao;

  @Generated(hash = 836208140)
  public Notes(Long id, String desc, String expireDate, Date startTimes, Date endTimes,
      String userNames, int descType, String filePath) {
    this.id = id;
    this.desc = desc;
    this.expireDate = expireDate;
    this.startTimes = startTimes;
    this.endTimes = endTimes;
    this.userNames = userNames;
    this.descType = descType;
    this.filePath = filePath;
  }

  @Generated(hash = 1409607808) public Notes() {
  }

  public Long getId() {
    return this.id;
  }

  public void setId(Long id) {
    this.id = id;
  }

  public String getDesc() {
    return this.desc;
  }

  public void setDesc(String desc) {
    this.desc = desc;
  }

  public String getExpireDate() {
    return this.expireDate;
  }

  public void setExpireDate(String expireDate) {
    this.expireDate = expireDate;
  }

  public Date getStartTimes() {
    return this.startTimes;
  }

  public void setStartTimes(Date startTimes) {
    this.startTimes = startTimes;
  }

  public Date getEndTimes() {
    return this.endTimes;
  }

  public void setEndTimes(Date endTimes) {
    this.endTimes = endTimes;
  }

  public String getUserNames() {
    return this.userNames;
  }

  public void setUserNames(String userNames) {
    this.userNames = userNames;
  }

  public int getDescType() {
    return this.descType;
  }

  public void setDescType(int descType) {
    this.descType = descType;
  }

  public String getFilePath() {
    return this.filePath;
  }

  public void setFilePath(String filePath) {
    this.filePath = filePath;
  }

  /**
   * To-many relationship, resolved on first access (and after reset).
   * Changes to to-many relations are not persisted, make changes to the target entity.
   */
  @Generated(hash = 1908638158) public List<RemindUser> getUserList() {
    if (userList == null) {
      final DaoSession daoSession = this.daoSession;
      if (daoSession == null) {
        throw new DaoException("Entity is detached from DAO context");
      }
      RemindUserDao targetDao = daoSession.getRemindUserDao();
      List<RemindUser> userListNew = targetDao._queryNotes_UserList(id);
      synchronized (this) {
        if (userList == null) {
          userList = userListNew;
        }
      }
    }
    return userList;
  }

  /** Resets a to-many relationship, making the next get call to query for a fresh result. */
  @Generated(hash = 1517531020) public synchronized void resetUserList() {
    userList = null;
  }

  /**
   * Convenient call for {@link org.greenrobot.greendao.AbstractDao#delete(Object)}.
   * Entity must attached to an entity context.
   */
  @Generated(hash = 128553479) public void delete() {
    if (myDao == null) {
      throw new DaoException("Entity is detached from DAO context");
    }
    myDao.delete(this);
  }

  /**
   * Convenient call for {@link org.greenrobot.greendao.AbstractDao#refresh(Object)}.
   * Entity must attached to an entity context.
   */
  @Generated(hash = 1942392019) public void refresh() {
    if (myDao == null) {
      throw new DaoException("Entity is detached from DAO context");
    }
    myDao.refresh(this);
  }

  /**
   * Convenient call for {@link org.greenrobot.greendao.AbstractDao#update(Object)}.
   * Entity must attached to an entity context.
   */
  @Generated(hash = 713229351) public void update() {
    if (myDao == null) {
      throw new DaoException("Entity is detached from DAO context");
    }
    myDao.update(this);
  }

  /** called by internal mechanisms, do not call yourself. */
  @Generated(hash = 1115019267)
  public void __setDaoSession(DaoSession daoSession) {
      this.daoSession = daoSession;
      myDao = daoSession != null ? daoSession.getNotesDao() : null;
  }
}
